home *** CD-ROM | disk | FTP | other *** search
/ The Disc - MacWorld 1995 / PowerComputing (The Disc)(MacWorld 1995).ISO / mac / CDFACTOR / NEW_DEMO / CDFACTORY / CDFACTORY.DXR / 00057_Start and Stop.ls < prev    next >
Encoding:
Text File  |  1995-07-13  |  11.6 KB  |  319 lines

  1. global onIBM, theQTMovie, gStartVolume, gmasterfolderpath, gDelimiter, gFileName, theBlitPict, theSparkle, objPreview, objIndexBtn, objalphabetbtn, objChapterBtn, objVolumeBtn, objCaptureGrid, objCapturePict
  2.  
  3. on startMovie
  4.   watchon()
  5.   repeat with n = 1 to 48
  6.     set the visible of sprite n to 0
  7.   end repeat
  8.   updateStage()
  9.   watchon()
  10.   openingupsetting()
  11.   watchon()
  12.   setindexprop()
  13.   initialsetting()
  14.   setMenu()
  15.   setIndexBtn()
  16.   watchon()
  17. end
  18.  
  19. on stopMovie
  20.   if objectp(theQTMovie) then
  21.     QTPause(theQTMovie)
  22.     QTDispose(theQTMovie)
  23.   end if
  24.   repeat with n = 1 to 48
  25.     set the visible of sprite n to 0
  26.     set the puppet of sprite n to 0
  27.   end repeat
  28.   updateStage()
  29.   importFileInto(cast 1, gmasterfolderpath & "GRAPHIC" & gDelimiter & "QUIT.PCT")
  30.   set the regPoint of cast 1 to point(the width of cast 1 / 2, the height of cast 1 / 2)
  31.   go("logo")
  32.   set the visible of sprite 1 to 1
  33.   updateStage()
  34.   startTimer()
  35.   repeat while the timer < 120
  36.   end repeat
  37.   killpreview()
  38.   killsparkle(theSparkle)
  39.   killCaptureGrid()
  40.   killIndexBtn()
  41.   if onIBM then
  42.     closeXLib("FILEIO.DLL")
  43.     closeXLib("BLITPICT.DLL")
  44.     closeXLib("BATQT.DLL")
  45.   end if
  46.   set gStartVolume to the soundLevel
  47.   clearGlobals()
  48. end
  49.  
  50. on startOver
  51.   repeat with n = 48 down to 1
  52.     set the visible of sprite n to 0
  53.     set the puppet of sprite n to 0
  54.   end repeat
  55.   updateStage()
  56.   killpreview()
  57.   if objectp(theQTMovie) then
  58.     QTDispose(theQTMovie)
  59.   end if
  60.   killsparkle(theSparkle)
  61.   killCaptureGrid()
  62.   killIndexBtn()
  63.   set objPreview to EMPTY
  64.   set theBlitPict to EMPTY
  65.   set theSparkle to EMPTY
  66.   set theQTMovie to EMPTY
  67.   set objIndexBtn to EMPTY
  68.   set objalphabetbtn to EMPTY
  69.   set objChapterBtn to EMPTY
  70.   set objVolumeBtn to EMPTY
  71.   set objCapturePict to EMPTY
  72.   set objCaptureGrid to EMPTY
  73.   if onIBM then
  74.     closeXLib("FILEIO.DLL")
  75.     closeXLib("BLITPICT.DLL")
  76.     closeXLib("BATQT.DLL")
  77.   end if
  78.   put "." into field 32
  79.   put "." into field 33
  80.   put "." into field 34
  81.   put "." into field 37
  82.   put "." into field 35
  83.   clearGlobals()
  84.   unLoadCast()
  85. end
  86.  
  87. on openingupsetting
  88.   global glessonlist, glessonnumber, objChapterBtn, gChapterBtnLocList, objVolumeBtn, gVolumeBtnLocList, gallchapterlist, galllessonlist, gHelpChapter, gHelpParagraph, gKeywordDataList, gkeywordtext, gAlphabetExist
  89.   set the exitLock to 1
  90.   set the keyDownScript to "filterQuit"
  91.   set gStartVolume to the soundLevel
  92.   if the machineType = 256 then
  93.     set onIBM to 1
  94.     set gDelimiter to "\"
  95.     set gFileName to [:]
  96.     addProp(gFileName, #INITXT, "INI.TXT")
  97.     addProp(gFileName, #PREVIEW, "GRAPHIC\PREVIEW.BMP")
  98.     addProp(gFileName, #sparkle, "GRAPHIC\SPARKLE.BMP")
  99.     addProp(gFileName, #INDEXBTN, "GRAPHIC\INDEXBTN.BMP")
  100.     addProp(gFileName, #INTROP, "INTRO.BMP")
  101.     addProp(gFileName, #INTROM, "INTRO.MOV")
  102.     addProp(gFileName, #IFTXT, "GRAPHIC\IF.TXT")
  103.     addProp(gFileName, #Alphabet, "GRAPHIC\ALPHADN.BMP")
  104.     openXLib("FILEIO.DLL")
  105.     openXLib("BLITPICT.DLL")
  106.     openXLib("BATQT.DLL")
  107.     set objPreview to birth(script "blitPict parent for MPC")
  108.     set theBlitPict to birth(script "blitPict parent for MPC")
  109.     set theSparkle to birth(script "sparkle parent for MPC")
  110.     set theQTMovie to birth(script "batQT parent for MPC")
  111.     set objIndexBtn to birth(script "blitPict parent for MPC")
  112.     set objalphabetbtn to birth(script "blitPict parent for MPC")
  113.     set objCapturePict to birth(script "blitPict parent for MPC")
  114.     set objCaptureGrid to birth(script "blitPict parent for MPC")
  115.   else
  116.     set onIBM to 0
  117.     set gDelimiter to ":"
  118.     set gFileName to [:]
  119.     addProp(gFileName, #INITXT, "INI.TXT")
  120.     addProp(gFileName, #PREVIEW, "GRAPHIC:PREVIEW.PCT")
  121.     addProp(gFileName, #sparkle, "GRAPHIC:SPARKLE.PCT")
  122.     addProp(gFileName, #INDEXBTN, "GRAPHIC:INDEXBTN.PCT")
  123.     addProp(gFileName, #INTROP, "INTRO.PCT")
  124.     addProp(gFileName, #INTROM, "INTRO.MOV")
  125.     addProp(gFileName, #IFTXT, "GRAPHIC:IF.TXT")
  126.     addProp(gFileName, #Alphabet, "GRAPHIC:ALPHADN.PCT")
  127.     set objPreview to birth(script "blitPict parent for Mac")
  128.     set theBlitPict to birth(script "blitPict parent for Mac")
  129.     set theSparkle to birth(script "sparkle parent for Mac")
  130.     set theQTMovie to birth(script "QTMovie parent for Mac")
  131.     set objIndexBtn to birth(script "blitPict parent for Mac")
  132.     set objalphabetbtn to birth(script "blitPict parent for Mac")
  133.     set objCapturePict to birth(script "blitPict parent for Mac")
  134.     set objCaptureGrid to birth(script "blitPict parent for Mac")
  135.   end if
  136.   fileIOread(the pathName & getProp(gFileName, #INITXT))
  137.   set initxtfile to the result
  138.   if item 3 of line 1 of initxtfile = EMPTY then
  139.     set external to 0
  140.   else
  141.     set external to integer(item 3 of line 1 of initxtfile)
  142.   end if
  143.   if onIBM then
  144.     if the controlDown or (external <> 0) then
  145.       set thePath to line 2 of initxtfile
  146.       set the itemDelimiter to ":"
  147.       openXLib("LabelDrv")
  148.       set objLabelDrv to LabelDrv(mnew)
  149.       objLabelDrv(mSetRange, "A", "Z")
  150.       set driveName to objLabelDrv(mGetDrive, item 1 of thePath)
  151.       objLabelDrv(mdispose)
  152.       closeXLib("LabelDrv")
  153.       set gmasterfolderpath to char 1 of driveName & ":\"
  154.       repeat with n = 2 to the number of items in thePath - 1
  155.         put item n of thePath & "\" after gmasterfolderpath
  156.       end repeat
  157.       set the itemDelimiter to ","
  158.     else
  159.       set thePath to line 2 of initxtfile
  160.       set the itemDelimiter to ":"
  161.       set thefoldername to item the number of items in thePath - 1 of thePath
  162.       set gmasterfolderpath to the pathName & thefoldername & "\"
  163.       set the itemDelimiter to ","
  164.     end if
  165.   else
  166.     if the controlDown or (external <> 0) then
  167.       set gmasterfolderpath to line 2 of initxtfile
  168.     else
  169.       set thePath to line 2 of initxtfile
  170.       set the itemDelimiter to ":"
  171.       set thefoldername to item the number of items in thePath - 1 of thePath
  172.       set gmasterfolderpath to the pathName & thefoldername & ":"
  173.       set the itemDelimiter to ","
  174.     end if
  175.   end if
  176.   fileIOread(gmasterfolderpath & "PREP1.TXT")
  177.   set glessonlist to the result
  178.   set glessonnumber to the number of lines in glessonlist
  179.   set the text of cast 32 to glessonlist
  180.   set objGraphic to birth(script "parent <change graphic>")
  181.   importGraphic(objGraphic, external)
  182.   set objGraphic to EMPTY
  183.   set objChapterBtn to birth(script "Parent<Slider>", gChapterBtnLocList, 13)
  184.   set objVolumeBtn to birth(script "Parent<Slider>", gVolumeBtnLocList, 14)
  185.   slideListSet(objVolumeBtn, 8)
  186.   fileIOread(gmasterfolderpath & "PREP2.TXT")
  187.   set galllessonlist to getAt(value(the result), 1)
  188.   set gallchapterlist to getAt(value(the result), 2)
  189.   if gHelpChapter = 0 then
  190.     set gHelpChapter to glessonnumber
  191.   else
  192.     if gHelpChapter > glessonnumber then
  193.       set gHelpChapter to glessonnumber
  194.     end if
  195.   end if
  196.   set theLastParagraph to getAt(getAt(galllessonlist, gHelpChapter), 2)
  197.   if gHelpParagraph = 0 then
  198.     set gHelpParagraph to theLastParagraph
  199.   else
  200.     if gHelpParagraph > theLastParagraph then
  201.       set gHelpParagraph to theLastParagraph
  202.     end if
  203.   end if
  204.   fileIOread(gmasterfolderpath & "PREP3.TXT")
  205.   set gkeywordtext to the result
  206.   fileIOread(gmasterfolderpath & "PREP4.TXT")
  207.   set gKeywordDataList to getAt(value(the result), 1)
  208.   set gAlphabetExist to getAt(value(the result), 2)
  209. end
  210.  
  211. on initialsetting
  212.   global gPauseMode, gcurrlessonnumber, gcurrchapternumber, gchapternumber, gstartupflag, theSparkle, gPICTQTList
  213.   set gPauseMode to 1
  214.   setpreview()
  215.   set gcurrlessonnumber to 1
  216.   set gcurrchapternumber to 1
  217.   set gchapternumber to getchapternumber(gcurrlessonnumber)
  218.   set gstartupflag to 1
  219.   loadsparkle(theSparkle)
  220.   set gPICTQTList to []
  221.   set pictscreenlist to []
  222.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1])
  223.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1])
  224.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1])
  225.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1])
  226.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1])
  227.   add(pictscreenlist, [0, 0, 0, 0, 0, 2, 0, 2, 2, 2, 1, 1, 1, 0, 1])
  228.   add(pictscreenlist, [0, 0, 0, 0, 0, 2, 0, 2, 2, 2, 1, 1, 1, 0, 1])
  229.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 2, 1, 1, 1, 1, 1, 0, 1])
  230.   add(pictscreenlist, [0, 0, 0, 0, 0, 2, 0, 2, 2, 2, 1, 1, 1, 0, 1])
  231.   add(pictscreenlist, [0, 0, 0, 0, 0, 2, 0, 2, 2, 2, 1, 1, 1, 0, 1])
  232.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 2, 2, 2, 0, 2])
  233.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 2, 2, 2, 0, 2])
  234.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 2, 2, 2, 0, 2])
  235.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 2, 2, 2, 0, 2])
  236.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 2, 2, 2, 0, 2])
  237.   set prevclrlist to []
  238.   add(prevclrlist, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
  239.   add(prevclrlist, [3, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2])
  240.   add(prevclrlist, [3, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2])
  241.   add(prevclrlist, [1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0])
  242.   add(prevclrlist, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
  243.   add(prevclrlist, [3, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2])
  244.   add(prevclrlist, [3, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2])
  245.   add(prevclrlist, [3, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2])
  246.   add(prevclrlist, [3, 1, 3, 2, 3, 1, 1, 1, 0, 1, 2, 0, 2, 2, 2])
  247.   add(prevclrlist, [2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2])
  248.   add(prevclrlist, [1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0])
  249.   add(prevclrlist, [3, 1, 3, 2, 3, 1, 1, 1, 0, 1, 2, 0, 2, 2, 2])
  250.   add(prevclrlist, [3, 1, 1, 2, 3, 1, 1, 1, 0, 1, 2, 0, 0, 2, 2])
  251.   add(prevclrlist, [1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0])
  252.   add(prevclrlist, [0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0])
  253.   set smallscreenlist to [1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0]
  254.   set gPICTQTList to [pictscreenlist, prevclrlist, smallscreenlist]
  255. end
  256.  
  257. on setindexprop
  258.   global galllessonlist, gindexmaplist, ggridlist, gMaxKwdFld, gSelLine, glastline, gkeywordtext, gSpliteSetList
  259.   set gindexmaplist to []
  260.   repeat with n = 1 to count(galllessonlist)
  261.     set theparagraphno to getAt(getAt(galllessonlist, n), 2)
  262.     set indexMapList to []
  263.     if theparagraphno <> 0 then
  264.       setAt(indexMapList, theparagraphno, 0)
  265.     end if
  266.     add(gindexmaplist, indexMapList)
  267.   end repeat
  268.   set the text of cast 35 to the text of cast 32
  269.   set the text of cast 34 to line 1 to 24 of gkeywordtext
  270.   set indexbtnsize to 12
  271.   set maxh to 27
  272.   set maxv to 23
  273.   set originx to 151
  274.   set originy to 114
  275.   set captureArea to originx & "," & originy & "," & originx + (indexbtnsize * maxh) & "," & originy + (indexbtnsize * maxv)
  276.   set theHalf to float(indexbtnsize / 2)
  277.   set theHalfLeft to originx - theHalf
  278.   set theHalfTop to originy - theHalf
  279.   set ggridlist to [originx, originy, maxh, maxv, indexbtnsize, captureArea, theHalfLeft, theHalfTop]
  280.   set gMaxKwdFld to 24
  281.   set gSelLine to 0
  282.   set glastline to the number of lines in gkeywordtext
  283.   if glastline > gMaxKwdFld then
  284.     add(gSpliteSetList, [26, 37, 28, 29, 30, 31, 32, 33, 35, 36])
  285.     add(gSpliteSetList, [26, 37, 28, 29, 32, 33, 35, 36])
  286.   else
  287.     add(gSpliteSetList, [26, 37, 28, 29, 32, 33, 35, 36])
  288.     add(gSpliteSetList, [26, 37, 28, 29, 32, 33, 35, 36])
  289.   end if
  290. end
  291.  
  292. on fileIOwrite thePath, theText
  293.   if objectp(objfileio) then
  294.     objfileio(mdispose)
  295.   end if
  296.   set objfileio to FileIO(mnew, "write", thePath)
  297.   if objectp(objfileio) then
  298.     objfileio(mWriteString, theText)
  299.     objfileio(mdispose)
  300.   else
  301.     alert(thePath && "write error")
  302.   end if
  303. end
  304.  
  305. on fileIOread thePath
  306.   if objectp(objfileio) then
  307.     objfileio(mdispose)
  308.   end if
  309.   set objfileio to FileIO(mnew, "read", thePath)
  310.   if objectp(objfileio) then
  311.     set theText to objfileio(mReadFile)
  312.     objfileio(mdispose)
  313.   else
  314.     alert(thePath && "read error")
  315.     quit()
  316.   end if
  317.   return theText
  318. end
  319.